// $Id$
// Licensed under Apache License Version 2.0
// See: http://www.apache.org/licenses/LICENSE-2.0.html
package de.servicezombie.tcmdb.rest;

import de.servicezombie.tcmdb.rest.vo.ActivityStatus;
import de.servicezombie.tcmdb.rest.vo.WsTestcaseDefinition;

public class DocumentTypeMatcher {
	
	private DocumentType documentType;
	
	public DocumentTypeMatcher(DocumentType documentType) {
		super();
		this.documentType = documentType;
	}

	public boolean isMatching(WsTestcaseDefinition definition) {
		ActivityStatus status = definition.getStatus();
		
		switch(documentType) {
			case ALL:
				return true;
			case ACTIVE:
				return ActivityStatus.ACTIVE.equals(status);
			case ARCHIVED:
				return ActivityStatus.OUTDATED.equals(status)						
						|| ActivityStatus.TEMPORARY_INACTIVE.equals(status);
			case IN_SPECIFICATION:
				return ActivityStatus.IN_SPECIFICATION.equals(status);
		}
		
		return false;
	}

}
